package com.baosight.sczx.common.zm.cInterface.cs;

import java.util.HashMap;
import java.util.List;

import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;
import com.baosight.sczx.common.zm.cInterface.CmesConstants;
import com.baosight.sczx.zm.cs.domain.ZMCSSystemSettingCS;

/**
 * 系统设置-系统基础管理
 * <p>Title: SystemSettingCS.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 严洪浩
 * @version 1.0
 * <pre>Histroy:
 *          2011-1-18 下午07:46:38  严洪浩  Create
 *</pre>
 */
public class SystemSettingCS {
	
	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	private static SystemSettingCS instance = new SystemSettingCS();
	private static ZMCSSystemSettingCS systemSetting;
	
	private SystemSettingCS(){
		initData();//当第一次使用的时候初始化
	}
	
	@SuppressWarnings("unchecked")
	private void initData(){
		List<ZMCSSystemSettingCS> _list = dao.query("ZMCSSystemSettingCS.query", new HashMap<String, String>());
		if(_list.size() < 1) {
			systemSetting = null;
		}
		else {
			systemSetting = _list.get(0);
		}
		CmesConstants.SYSTEMSETTING_CS = 0;
	}
	
	/**
	 * 得到系统模式 0矿级模式 1分子公司 2集团公司
	 * <p>Function: getSystemModel</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午07:58:20 严洪浩
	 * </p>
	 *
	 */
	public String getSystemModel(){
		String _temp = new String("0");//默认为 0 矿级模式
		if(systemSetting != null) {
			_temp = systemSetting.getFdSystemModel();
		}
		
		return _temp;
	}
	
	/**
	 * 得到矿区形式 0单矿区 1多矿区
	 * <p>Function: getMiningType</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:17:55 严洪浩
	 * </p>
	 *
	 */
	public String getMiningType(){
		String _temp = new String("0");//默认为 0单矿区
		if(systemSetting != null) {
			_temp = systemSetting.getFdMiningType();
		}
		
		return _temp;
	}
	
	/**
	 * 得到系统名称 默认 “安全生产管控信息系统”
	 * <p>Function: getSystemName</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:18:36 严洪浩
	 * </p>
	 *
	 */
	public String getSystemName(){
		String _temp = "安全生产管控信息系统";
		if(systemSetting != null) {
			_temp = systemSetting.getFdSystemName();
		}
		
		return _temp;
	}
	
	/**
	 * 获得系统版本号
	 * <p>Function: getVersion</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:20:27 严洪浩
	 * </p>
	 *
	 */
	public String getVersion(){
		String _temp = "3.0.0";
		if(systemSetting != null) {
			_temp = systemSetting.getFdVersion();
		}
		
		return _temp;
	}
	
	/**
	 * 得到最大用户数 默认为10
	 * <p>Function: getVersion</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午08:20:50 严洪浩
	 * </p>
	 *
	 */
	public Long getMaxUser(){
		Long _temp = new Long(10);
		if(systemSetting != null) {
			_temp = systemSetting.getFdMaxUser();
		}
		
		return _temp;
	}
	
	/**
	 * 得到工作面的模式 0自动 1手动 2生成
	 * <p>Function: fdWorkingfaceNo</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-12上午04:23:42 严洪浩
	 * </p>
	 *
	 */
	public String getWorkingfaceNo() {
		String _temp = "0";//工作面编号 0自动 1手动 2生成
		if(systemSetting != null) {
			_temp = systemSetting.getFdWorkingfaceNo();
		}
		
		return _temp;
	}
	
	/***
	 * 工作面的规则
	 * <p>Function: getEngineeringNoRule</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-5-23上午07:00:53 严洪浩
	 * </p>
	 *
	 */
	public String getWorkingfaceNoRule(){
		String _temp = "KJ+WM{4}";//工作面规则
		if(systemSetting != null) {
			_temp = systemSetting.getFdWorkingfaceNoRule();
		}
		
		return _temp;
	}
	
	/**
	 * 得到巷道的模式 0自动 1手动 2生成
	 * <p>Function: getRoadwayNo</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-12上午04:23:42 严洪浩
	 * </p>
	 *
	 */
	public String getRoadwayNo() {
		String _temp = "0";//巷道 0自动 1手动 2生成
		if(systemSetting != null) {
			_temp = systemSetting.getFdRoadwayNo();
		}
		
		return _temp;
	}
	
	/***
	 * 巷道的规则
	 * <p>Function: getRoadwayNoRule</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-5-23上午07:00:53 严洪浩
	 * </p>
	 *
	 */
	public String getRoadwayNoRule(){
		String _temp = "KJ+WM{4}";//巷道规则
		if(systemSetting != null) {
			_temp = systemSetting.getFdRoadwayNoRule();
		}
		
		return _temp;
	}
	
	/**
	 * 得到其他设计的模式 0自动 1手动 2生成
	 * <p>Function: getOtherDesignNo</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-6-12上午04:23:42 严洪浩
	 * </p>
	 *
	 */
	public String getOtherDesignNo() {
		String _temp = "0";//其他 0自动 1手动 2生成
		if(systemSetting != null) {
			_temp = systemSetting.getFdOtherDesignNo();
		}
		
		return _temp;
	}
	
	/***
	 * 巷道的规则
	 * <p>Function: getOtherDesignNoRule</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-5-23上午07:00:53 严洪浩
	 * </p>
	 *
	 */
	public String getOtherDesignNoRule(){
		String _temp = "KJ+WM{4}";//巷道规则
		if(systemSetting != null) {
			_temp = systemSetting.getFdOtherDesignNoRule();
		}
		
		return _temp;
	}
	
	/**
	 * 得到工程编号的模式 0自动 1手动 2生成
	 * <p>Function: getEngineeringNo</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-5-23上午06:59:32 严洪浩
	 * </p>
	 *
	 */
	public String getEngineeringNo(){
		String _temp = "0";//工程编号 0自动 1手动
		if(systemSetting != null) {
			_temp = systemSetting.getFdEngineeringNo();
		}
		
		return _temp;
	}
	
	/***
	 * 工程编号的规则
	 * <p>Function: getEngineeringNoRule</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-5-23上午07:00:53 严洪浩
	 * </p>
	 *
	 */
	public String getEngineeringNoRule(){
		String _temp = "KJ+GZM+WM{4}";//工程编号规则
		if(systemSetting != null) {
			_temp = systemSetting.getFdEngineeringNoRule();
		}
		
		return _temp;
	}
	
	/**
	 * 得到对象的唯一句柄
	 * <p>Function: getInstance</p>
	 * <p>Description: </p>
	 * <p>return value:SystemSettingCS</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午07:50:20 严洪浩
	 * </p>
	 *
	 */
	public static SystemSettingCS getInstance(){
		if(CmesConstants.SYSTEMSETTING_CS == 1) {
			instance = new SystemSettingCS();
		}
		
		return instance;
	}
}
